import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttrValueVO, AttrValueForm, AttrValueQuery } from '@/api/apartment/attribute/attrValue/types';

/**
 * 查询房间基本属性值列表
 * @param query
 * @returns {*}
 */

export const listAttrValue = (query?: AttrValueQuery): AxiosPromise<AttrValueVO[]> => {
  return request({
    url: '/apartment/attrValue/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询房间基本属性值详细
 * @param id
 */
export const getAttrValue = (id: string | number): AxiosPromise<AttrValueVO> => {
  return request({
    url: '/apartment/attrValue/' + id,
    method: 'get'
  });
};

/**
 * 新增房间基本属性值
 * @param data
 */
export const addAttrValue = (data: AttrValueForm) => {
  return request({
    url: '/apartment/attrValue',
    method: 'post',
    data: data
  });
};

/**
 * 修改房间基本属性值
 * @param data
 */
export const updateAttrValue = (data: AttrValueForm) => {
  return request({
    url: '/apartment/attrValue',
    method: 'put',
    data: data
  });
};

/**
 * 删除房间基本属性值
 * @param id
 */
export const delAttrValue = (id: string | number | Array<string | number>) => {
  return request({
    url: '/apartment/attrValue/' + id,
    method: 'delete'
  });
};
